﻿using System;
using System.Collections.Generic;
using System.Text;
using METODESA.Server.Data.METODESA.Entity;
using NHibernate;

namespace METODESA.Server.Data.METODESA.Nhibernate
{
    public class DetalleCompraDao:BaseDao
    {
        public static DetalleCompra getDetalleById(int id)
        {
            DetalleCompra detalle = null;
            Boolean flag = true;

            try
            {
                myISession = NHibernateHelper.GetCurrentSession();
                detalle = (DetalleCompra)myISession.Load(typeof(DetalleCompra), id);
                flag = false;
            }
            catch (HibernateException e)
            {
                Console.Out.WriteLine(e.Message);

            }

            if (flag)
            {
                //throw new EntityNotExistsException("There's no client with the provided id");
                return null;
            }

            return detalle;
        }
    }
}
